package com.etlmaster.executor.steps.file;

import java.util.regex.Pattern;

import com.etlmaster.executor.StepMeta;

public class FileScanStepMeta extends StepMeta {
	
	private String sourceDirs;
	
	private String fileNameFilter;
	
	private int intervalday;
	
	private String before;
	private boolean depthwise;
	
	public FileScanStepMeta(String id, String name,String step_code, String session_id, String paramStr) {
		super(id, name,step_code, session_id, paramStr);
	}

	public String[] getSourceDirs() {
		return sourceDirs!=null?variableSubstitution(sourceDirs).split(";"):new String[]{};
	}

	public void setSourceDirs(String sourceDirs) {
		this.sourceDirs = sourceDirs;
	}

	public String getFileNameFilter() {
		return variableSubstitution(fileNameFilter);
	}

	public void setFileNameFilter(String fileNameFilter) {
		this.fileNameFilter = fileNameFilter;
	}

	public boolean isDepthwise() {
		return depthwise;
	}

	public void setDepthwise(boolean depthwise) {
		this.depthwise = depthwise;
	}

	protected void loadParamsFromConfigTable() {
	}

	public Pattern builderPattern(){
		String fileNameFilter = getFileNameFilter();
		if(fileNameFilter!=null && fileNameFilter.length()>0){
			return Pattern.compile(fileNameFilter);
		}
		return null;
	}

	public int getIntervalday() {
		return intervalday;
	}

	public void setIntervalday(int intervalday) {
		this.intervalday = intervalday;
	}

	public String getBefore() {
		return before;
	}

	public void setBefore(String before) {
		this.before = before;
	}
	
}